<%@page language="java" pageEncoding="utf-8"%>
<%@page import="java.util.*"%>
<%@page import="dreamtime.dreamnews.news.*"%>
<%@page import="java.util.HashMap"%>
<%@page import="java.sql.*"%>
<%@page import="dreamtime.dreamnews.*"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.text.SimpleDateFormat"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新闻浏览</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<body>
<%      
	 int smallclassid=1;
	 int startNum=0;
	 int listNum=11;
	 int titleNum=10;
	 int modelNum=1;
                String idString=request.getParameter("smallclassid");
        if(idString!=null&&idString.matches("[0-9]*[1-9][0-9]*")){
        smallclassid=Integer.parseInt(idString);
        }
                String startString=request.getParameter("startNum");
        if(startString!=null&&startString.matches("[0-9]*[1-9][0-9]*")){
        startNum=Integer.parseInt(startString);
        }
                String listString=request.getParameter("listNum");
        if(listString!=null&&listString.matches("[0-9]*[1-9][0-9]*")){
        listNum=Integer.parseInt(listString);
        }
                String titleString=request.getParameter("titleNum");
        if(titleString!=null&&titleString.matches("[0-9]*[1-9][0-9]*")){
        titleNum=Integer.parseInt(titleString);
        }
                String modelString=request.getParameter("modelNum");
        if(modelString!=null&&modelString.matches("[0-9]*[1-9][0-9]*")){
        modelNum=Integer.parseInt(modelString);
        }
        DBConnection accessconn=new DBConnection();
        Connection conn=null;
        PreparedStatement pstmt=null;
		ResultSet rs=null;	
		try{ 
        conn=accessconn.getConn();
        pstmt=conn.prepareStatement("select newsid,newstitle,newstime,newspicture from news where smallclassid=? order by newsid desc",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
        HashMap     reportNewsMap=LinkNews.getNewsMap(conn,pstmt,rs,smallclassid,startNum,listNum,titleNum);
		ArrayList   reportIdList=(ArrayList)reportNewsMap.get("newsid");
		ArrayList   reportTitleList=(ArrayList)reportNewsMap.get("newstitle");
		ArrayList   reportTimeList=(ArrayList)reportNewsMap.get("newstime");
%>
<ul>
<%for(int i=0;i<reportIdList.size();i++){ %>
<li>
<a
	href="<%=basePath%>automobile/newsContent.jsp?newsid=<%=(String)reportIdList.get(i)%>"
	title="<%=(String)reportTitleList.get(i)%>" target="_blank">*&nbsp;<%=(String)reportTitleList.get(i)%></a>
<%}%>
</li>
</ul>
<%
  }catch(SQLException se){
  out.print(se.getMessage());
  }finally{
  accessconn.closeResultSet(rs);
  accessconn.closePreparedStatement(pstmt);
  accessconn.closeConnection(conn);
  }
   %>
</body>
</html>